<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var arr = [23, 12, 1, 34, 116, 8, 18, 37, 56, 50];

    arr.sort();
    console.log(arr.sort());
    var res = arr.sort(function (a, b) {
        return a - b;
    })

    console.log(res);
    var res = arr.sort(function (a, b) {
        return b - a;
    })
    console.log(res);

    var res = arr.sort((a, b) => {
        return b - a;
    })
    console.log(res);

    var res = arr.sort((a, b) => b - a)
    console.log(res, res[0]);
</script>

</html>